import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/part-master/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/part-master/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/part-master/remove',
    method: 'get',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/part-master/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-admin/part-master/submit',
    method: 'post',
    data: row
  });
};

export const getPartType = () => {
  return request({
    url: '/api/blade-system/dict/dictionary?code=part_type',
    method: 'get',
    params: {}
  });
};

export const getInspection = () => {
  return request({
    url: '/api/blade-system/dict/dictionary?code=inspection_mode',
    method: 'get',
    params: {}
  });
};

export const updateStatus = (row) => {
  return request({
    url: '/api/mes-admin/part-master/update-status',
    method: 'post',
    data: row
  });
};

export const testCriterion = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-attr-criterion/submit',
    method: 'post',
    data
  });
};

export const deleteCriterion = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-attr-criterion/delete',
    method: 'post',
    data
  });
};

export const getCategory = (data) => {
  return request({
    url: '/api/mes-admin/part-category/tree',
    method: 'get'
  });
};
